<template>
  <div class="container">
    <div class="header">
      <img src="../../assets/login/logoxhw.png" alt="" />
    </div>
    <div class="formBox">
      <div class="form-title">欢迎登录</div>
      <div class="form-subtitle">欣环卫智慧安全平台</div>
      <div class="formContent">
        <el-form ref="form" :model="form" label-width="0">
          <el-form-item class="formItem">
            <el-input v-model="form.account" placeholder="请输入用户名">
              <img src="@/assets/common/组 1.png" alt="" slot="prefix" />
            </el-input>
          </el-form-item>
          <el-form-item class="formItem">
            <el-input  type="password"  v-model="form.password" placeholder="请输入密码">
              <img src="@/assets/common/组 3.png" alt="" slot="prefix" />
            </el-input>
          </el-form-item>
          <el-form-item class="formItem">
            <el-button class="loginBtn" type="primary" @click="onSubmit"
              >立即登录</el-button
            >
          </el-form-item>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        account: '',
        password: '',
      },
    };
  },
  created() {},
  methods: {
  async  onSubmit() {
      const obj = {
        userName: this.form.account,
        password: this.form.password,
      }
      await this.$store.dispatch('user/storeLogin', obj)
      this.$router.push("/");
    },
  },
};
</script>

<style lang="scss" scoped>
.container {
  background-image: url("../../assets/login/xhw.png");
  background-size: cover;
  background-repeat: no-repeat;

  // height: 100vh;
  // width: 100vw;
  width: 100%;
  height: 100%;
  margin: 0 auto;
  .header {
    position: absolute;
    left: 0;
    top: 24px;
    width: 480px;
    height: 80px;
    background: linear-gradient(90deg, #ffffff 0%, rgba(255, 255, 255, 0) 100%);
    border-radius: 0px 0px 0px 0px;
    padding: 22px 0 0 48px;
    img {
      width: 190px;
      height: 36px;
    }
  }
  .formBox {
    width: 600px;
    height: 688px;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 3px 3px 3px #a7a6a6;
    position: fixed;
    right: 240px;
    top: 192px;
    padding: 40px 40px;
    .form-title {
      font-weight: bold;
      font-size: 32px;
      color: #313533;
      padding-left: 10px; /* 根据需要调整 */
      position: relative;
    }

    .form-title::before {
      content: "";
      display: block;
      width: 4px; /* 竖条的宽度 */
      height: 28px; /* 竖条的高度 */
      background-color: #34982f; /* 竖条的颜色 */
      position: absolute;
      left: 0;
      transform: translateY(-50%); /* 向上移动自身高度的50% */
      top: 50%;
    }
    .form-subtitle {
      font-weight: 400;
      font-size: 28px;
      color: #313533;
      margin: 32px 0 42px;
    }
    .formContent {
      .el-form-item{
        margin-bottom: 32px;
      }
      ::v-deep .el-form-item__content {
        height: 64px;
      }
      ::v-deep .el-input__inner {
        height: 64px !important;
        line-height: 64px;
        padding-left: 40px;
      }
      img {
        margin-top: 15px;
        width: 32px;
        height: 32px;
      }
      .loginBtn {
        width: 504px;
        height: 64px;
        background: linear-gradient(90deg, #249451 0%, #1a5632 100%);
        border-radius: 4px 4px 4px 4px;
        border: none;
        font-weight: bold;
        font-size: 18px;
        color: #ffffff;
      }
    }
  }
}
</style>
